<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<link rel="stylesheet" type="text/css" href="js/easyui/themes/gray/easyui.css">
	<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
	<script type="text/javascript" src="js/easyui/jquery.easyui.min.js"></script>
	
	<script>
		$(function() {
		////////console.log('load');
		$
				.get(
						'owf/getMyToDoLeaveList.action',
						function(data) {
							data = decodeURIComponent(data);
							data = $.parseJSON(data);
							if (true) {
								var columns = [
										{
											field : 'ITEM_TYPE',
											title : 'ITEM_TYPE',
											width : 100
										},
										{
											field : 'ITEM_KEY',
											title : 'ITEM_KEY',
											width : 100
										},
										{
											field : 'APP_DATE',
											title : '申请时间',
											width : 100
										},
										{
											field : 'EMPLOYEE',
											title : '申请人',
											width : 80
										},
										{
											field : 'MANAGER',
											title : '领导',
											width : 80
										},
										{
											field : 'APP_START_DATE',
											title : '请假开始时间',
											width : 100
										},
										{
											field : 'APP_END_DATE',
											title : '请假结束时间',
											width : 100
										},
										
										{
											field : 'STATUS',
											title : '当前状态',
											width : 100
										},
										{
											field : 'ASSIGNED_USER',
											title : '当前任务人',
											width : 100
										},
										{
											field : 'ACTIVITY_NAME',
											title : '当前阶段',
											width : 100
										},
										{
											field : 'dispatch',
											title : '操作',
											width : 100,
											align : 'center',
											formatter : function(value, rec,
													index) {
												var html = '';
												if (value == null)
													return '';
												if (value.funRole == 'sender') {
													if (value.funTimerState == 'running')
														html = '<a class="timerBtn" href="javascript:void(0)" onclick="stop('
																+ index
																		.toString()
																+ ',this)">停止定时任务</a>';
													else if (value.funTimerState == 'stopped')
														html = '<a class="timerBtn" href="javascript:void(0)" onclick="start('
																+ index
																		.toString()
																+ ',this)">启动定时任务</a>';
												} else if (value.funRole == 'receiver') {
													if (value.funListenerState == 'running')
														html = '<a class="timerBtn" href="javascript:void(0)" onclick="stopListener('
																+ index
																		.toString()
																+ ',this)">停止监听</a>';
													else if (value.funListenerState == 'stopped')
														html = '<a class="timerBtn" href="javascript:void(0)" onclick="startListener('
																+ index
																		.toString()
																+ ',this)">启动监听</a>';
												}
												return html;
											}
										} ];
								$('#all_list_div').datagrid({
									pagination : true,
									rownumbers : true,
									striped : true,
									height : 400,
									singleSelect : true,
									columns : [ columns ],
									toolbar : [ {
										text : '增加',
										iconCls : 'icon-add',
										handler : function() {
											changeToInsertMode();
										}
									}, {
										text : '新增并复制当前项',
										iconCls : 'icon-remove',
										handler : function() {
											changeToInsertModeAndCopyCurrent();
										}
									}, {
										text : '删除',
										iconCls : 'icon-remove',
										handler : function() {
											deleteConfig();
										}
									}, {
										text : '配置',
										iconCls : 'icon-edit'
									} ],
									onSelect : function(rowIndex, rowData) {
										onRowSelected(rowIndex, rowData);
									}
								});
								$('#all_list_div')
										.datagrid('loadData', data);
							}
						})
	});
	</script>
	

  </head>
  
  <body>
    <div id="all_list_div"></div>
  </body>
</html>
